1. Field of the Invention
The present invention relates to an intraprediction/interprediction method and apparatus, and more particularly, to a method and apparatus for encoding and decoding an image by performing more accurate intraprediction/interprediction with respect to an image processing unit including a plurality of sub blocks.
2. Description of the Related Art
In an image compression technique such as MPEG-1, MPEG-2, and MPEG-4H.264/MPEG-4 advanced video coding (AVC), in order to encode an image, a picture is divided into predetermined image processing units, for example, into macroblocks. The macroblocks are encoded by interprediction and intraprediction. Then, an optimal encoding mode is selected in consideration of the size of the data of the encoded macroblocks and the degree of distortion of the original macroblocks.
In intraprediction, in order to encode each of the blocks of a current picture, a reference picture is not referred to, but instead a value of a pixel spatially adjacent to each block that is to be encoded is referred to. First, a predicted pixel value of a current block that is to be encoded is calculated by referring to a value of a pixel adjacent to the current block. Then, only a residue corresponding to a difference between the predicted pixel value and the actual pixel value of the current block is encoded. Intraprediction modes are roughly divided into intraprediction modes for luminance, such as a 4×4 intraprediction mode, an 8×8 intraprediction mode, and a 16×16 intraprediction mode, and intraprediction modes for chrominance.
FIGS. 1A and 1B illustrate conventional intraprediction modes.
FIG. 1A illustrates conventional 16×16 intraprediction modes. Referring to FIG. 1A, there exist a total of 4 conventional 16×16 intraprediction modes, namely, a vertical mode, a horizontal mode, a DC (direct current) mode, and a plane mode.
FIG. 1B illustrates conventional 4×4 intraprediction modes. Referring to FIG. 1B, there exist a total of 9 conventional 4×4 intraprediction modes, namely, a vertical mode, a horizontal mode, a DC mode, a diagonal down-left mode, a diagonal down-right mode, a vertical right mode, a vertical left mode, a horizontal-up mode, and a horizontal-down mode.
In image encoding according to the H.264 standard, a current macroblock is encoded in a total of 13 modes including the 4×4 intraprediction modes and 16×16 intraprediction modes, and thus intraprediction encoding is performed in an optimal mode from among the 13 modes. The optimal mode is selected in consideration of a residue and a distortion between the original block and a predicted block.
Interprediction is a technique of compressing an image by removing temporal duplication between pictures. A motion estimation encoding technique is representative of interprediction. Motion estimation encoding is a technique of encoding an image by estimating a motion of a current picture on a block-by-block basis with reference to at least one reference picture and compensating for the estimated motion.
In motion estimation encoding, a block that is the most similar to a current block is searched for within a predetermined range of a reference picture by using a predetermined estimation function. When the most similar block is found, only a residue between the most similar block found from the reference picture and the current block is transmitted, thereby increasing the compression rate of data. Here, various sizes of blocks, such as, 16×16, 8×16, and 8×8, may be used as a block.
FIGS. 2A through 2D illustrate motion vector prediction performed in conventional interprediction. In FIGS. 2A through 2D, a method of predicting a motion vector of a current block 210 according to the H.264 standard is illustrated.
FIG. 2A illustrates a case where the current block 210 and neighboring blocks 221 through 223 have the same size. In this case, in the H.264 standard, a predicted motion vector corresponding to a predicted value of the motion vector of the current block 210 is determined according to a relation whereby the predicted motion vector equals center values mvA, mvB, and mvC. Since neighboring blocks are likely to have similarities, the motion vector of the current block 210 is determined to be the center values mvA, mvB, and mvC of the motion vectors of the neighboring blocks 221 through 223.
FIG. 2B illustrates a case where the current block 210 and the neighboring blocks 231 through 233 have different sizes. In this case, as shown in FIG. 2B, a center value mvA of a block 231 being at the uppermost location from among the blocks neighboring the left side of the current block 210, a center value mvB of a block 232 being at the leftmost location from among the blocks neighboring the upper side of the current block 210, and a center value mvC of a block 233 being at the leftmost location from among the blocks neighboring the right upper side of the current block 210 are determined as a predicted motion vector of the current block 210.
FIG. 2C illustrates a case where a current block 211 or 212 is not a square, that is, a case where the current block 211 or 212 is an 8×16 block.
When a current block is a block 211 which forms a square together with a block 212, the motion vector of a block 241 on the left side of the current block 211 is determined to be a predicted motion vector of the current block 211. On the other hand, when a current block is the block 212, the motion vector of a block 242 on the right upper side of the current block 211 is determined to be a predicted motion vector of the current block 212.
FIG. 2D illustrates a case where a current block 213 or 214 is not a square, that is, the current block 213 or 214 is a 16×8 block.
When a current block is a block 213 which forms a square together with a block 214, the motion vector of a block 251 on the left side of the current block 213 is determined to be a predicted motion vector of the current block 213. On the other hand, when a current block is the block 214, the motion vector of a block 252 on the upper side of the current block 214 is determined to be a predicted motion vector of the current block 214.
When a predicted motion vector of a current block is determined, a differential value between the predicted motion vector and an actual motion vector of the current block is encoded and inserted into a bitstream. Instead of transmitting information about the motion vector of the current block without changes to the information, the differential value is encoded and the encoded differential value is transmitted. Therefore, the compression rate of image data is increased.
In the intraprediction shown in FIGS. 1A and 1B, when the pixel value of the current block is more accurately predicted, the residue of the current block is decreased, and thus the compression rate for image encoding is increased. In the interprediction shown in FIGS. 2A through 2D, when a more accurately predicted motion vector corresponding to a predicted value of the motion vector of the current block is obtained, a differential value between the actual motion vector and the predicted motion vector of the current block is decreased, and thus the compression rate for image encoding is increased.
Therefore, an image encoding/decoding method, in which a pixel value of a current block can be more accurately predicted in intraprediction and a more accurately predicted motion vector of the current block can be obtained, is demanded.